<?php


require_once(MODEL_PATH.'/MAPI/APNS.php');

class Model_MAPI_APNS_Bookshelf_WW extends Model_MAPI_APNS {

	protected $production_cert = '/home/ww/config/APNS/wwreader-apns-prod-20140515.pem';
	protected $sandbox_cert    = '/home/ww/config/APNS/wwreader-apns-dev-20140515.pem';
	private   $production_table = '2013_ww_push_token_ios';
	private   $sandbox_table    = '2013_ww_push_token_ios_sandbox';
	protected $debug = true;

	//Override
	public function __construct($h_param) {
		
		$dbh_w = $h_param['dbh'];
		$mode = $h_param['mode'];
		
		if ($mode == 'production'){
			$table = $this->production_table;
	  } else {
	  	$mode = 'sandbox';
		  $table = $this->sandbox_table;
	  }
		parent::__construct($dbh_w, $mode, $table);
	}
	
	
	public function registerDevice($h_param){
		
		$push_token = $h_param['token'];
		  	
		$special_char = array(" ", "<", ">");
		$push_token = str_replace($special_char, "", $push_token);
    
		$h_param['token'] = $push_token;
    
		parent::registerDevice($h_param);		
	}


}
?>